package com.cdream.basic.algorithm.leetcode.removeDuplicate;

/**
 * @author cdream
 * @date 5/9/21
 */
public class Question80 {
    public int removeDuplicates(int[] nums) {
        int slow = 2;
        int fast = 2;

        while (fast < nums.length) {
            if (nums[fast] != nums[slow - 2]) {
                nums[slow] = nums[fast];
                slow++;
            }
            fast++;
        }
        return slow;
    }
}
